package io.renren.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import io.renren.entity.MemberEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
 * 用户表
 *
 * @author Mark
 * @email sunlightcs@gmail.com
 * @date 2020-10-13 11:31:58
 */
@Mapper
public interface MemberDao extends BaseMapper<MemberEntity> {
    /**
     * 获取用户信息
     * @param mobile
     * @return
     */
    @Select("select * from tb_member where mobile = #{mobile}")
    MemberEntity selectUser(String mobile);

    /**
     * 商户拒单修改用户积分
     * @param actualMoney
     * @param userId
     */
    @Update("update tb_member set integral = integral +#{actualMoney} where user_id = #{userId} ")
    void updateInteger(@Param("actualMoney") BigDecimal actualMoney, @Param("userId") Integer userId);
}
